#include "nokchuklib.h"
#include "x11_event.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>


//default channel
#define CHANNEL 3



int main(int argc, char **argv)
{
    nokchuk *global = NULL;
    int channel = CHANNEL;

    if(argc > 1){
        channel = atoi(argv[1]);
    }
    printf("Starting rfcomm service on port %i\n",channel);
    global = nokchuk_init(channel);
    nokchuk_start(global);

	while( global->action->type != END ){
		nokchuk_do_action(global);
	}
    // close connection
    nokchuk_stop(global);
    return 0;
}

